package com.biz.primus.ms.commodity.trans;

import com.biz.primus.commodity.vo.backend.UpdateCategoryVo;
import com.biz.primus.ms.commodity.dao.po.Category;
import com.google.common.base.Function;
import javax.annotation.Nullable;


/**
 * @author 江南
 * @usage
 * @reviewer
 * @since 2016/12/22
 */
public class Category2UpdateCategoryVo implements Function<Category,UpdateCategoryVo> {
    @Nullable
    @Override
    public UpdateCategoryVo apply(@Nullable Category input) {

        UpdateCategoryVo updateCategoryVo = new UpdateCategoryVo();
        updateCategoryVo.setSeoTitle(input.getSeoTitle());
        updateCategoryVo.setSeoKeywords(input.getSeoKeywords());
        updateCategoryVo.setLogo(input.getLogo());
        updateCategoryVo.setSeoDescription(input.getSeoDescription());
        updateCategoryVo.setId(input.getId());
        updateCategoryVo.setName(input.getName());
        updateCategoryVo.setStatus(input.getStatus());
        updateCategoryVo.setSaleChannel(input.getSaleChannel());
        if(input.getParent() != null){
        	updateCategoryVo.setParentCategoryId(input.getParent().getId());
        }
        return updateCategoryVo;
    }
}
